const {Article} = require('../../model/article');


module.exports = async (req, res) => {
    //侧边栏使用 标识，标识当前访问的是文章页面
    req.app.locals.currentLink = 'article';

    //判断是修改还是新增
    let id = req.query.id;
    if (id) {
        const article = await Article.findOne({_id:id});
        res.render('admin/article-edit',{article,id});
    } else {
        res.render('admin/article-edit');
    }


};
